Skip to content

refactor(durable): small cleanups from the #234 reviews - #274

Open
reka18 wants to merge 2 commits into
mainfrom
refactor/durable-234-review-cleanups
Open

reka18 wants to merge 2 commits into
mainfrom
refactor/durable-234-review-cleanups

Conversation

@reka18

@reka18 reka18 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What this does

These are two cleanups the #234 reviews found. Neither changes behavior.

  • One arming sequence. Forgetting a step's settled services, arming its timers (only when it schedules or cancels one) and absorbing its services is now one helper, armEffects. absorbDrivers, absorbSettle, absorbParentFire and the replay mirror replayArm all call it. Live and replay have to take the same clock reads in the same order, so one helper keeps a later change from updating one path and missing another. The order is the same everywhere: forget, then timers, then services. Ticks stay out, because the scheduler arms their timers itself.
  • One error helper. resultErrs and parentFireErrs are thin wrappers over one generic errsOf.

The third item in #248, parsing StateAt's baseline once, needs no change: main already decodes it once. The second parse came from a journal check that only this branch's old base carried.

Tests

No new tests, since behavior doesn't change. The existing tests guard it:

  • TestStateAt_ByteIdenticalAtEachStep, which checks that live and replay match;
  • the chained-deadline tests, which check the order of clock reads;
  • actor_driven_drivers_test.go.

All of them pass with -race after each commit. Swapping timers and services in the helper fails no test, because none of the steps between the seams reads the clock, starts a goroutine or calls host code.

Checks

  • mage check passes in every module (go1.27.4)
  • No CHANGELOG entry: behavior doesn't change

Closes #248

@reka18 reka18 added ready All ACR dimensions confirmed - clear to merge confirmed:correctness ACR clean: correctness confirmed:regression-safety ACR clean: regression-safety confirmed:concurrency-discipline ACR clean: concurrency-discipline confirmed:replay-determinism ACR clean: replay-determinism confirmed:api-compatibility ACR clean: api-compatibility confirmed:missed-context ACR clean: missed-context confirmed:human-readability ACR clean: human-readability confirmed:probes ACR: the probes lens's latest round found no blocker labels Nov 19, 2026
@reka18

reka18 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Review findings

The AI reviewers' pass over this change checked every review label. They found one real cleanup, which is fixed in the last commit:

  1. Tick's absorbServices inlined the services step instead of calling the new absorbIntoServices, so a later change to that step could miss the Tick path. It now calls absorbIntoServices.

Three candidates were refuted:

  • The folding dropped a guard or a step. Every nil check, hasTimerEffect guard and forget survives at all four sites.
  • Live and replay pass different seams. Every pair goes through the same helper with matching guards.
  • A host could observe the reorder. The forget step only deletes map entries, and absorbing services is bookkeeping under the runner's own lock. Neither reads the clock, so each step takes the same readings in either order.

@reka18

reka18 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Decisions for Temple to ratify

I made these calls in this PR. Each is a suggestion for you to confirm or change.

  1. One order for the arming sequence, live and replay alike: forget settled services, then arm timers, then absorb services. absorbParentFire used to forget first, while absorbDrivers and replayArm armed timers first. That difference can't be observed, since forgetting reads no clock, but it does reorder the live path.
  2. Ticks stay out of the helper. Their timers are armed by the scheduler, not by the timer effects the helper checks for.

@reka18
reka18 force-pushed the refactor/durable-service-result-cleanups branch from 700dac5 to 774cc37 Compare November 25, 2026 23:06
Base automatically changed from refactor/durable-service-result-cleanups to main November 26, 2026 00:25
Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
Closes #248.

Signed-off-by: Ray Karnes <ray.karnes@stablekernel.com>
@reka18
reka18 force-pushed the refactor/durable-234-review-cleanups branch from 13ac761 to 22cdf67 Compare November 26, 2026 04:25
@reka18
reka18 marked this pull request as ready for review November 26, 2026 04:25

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

confirmed:api-compatibility ACR clean: api-compatibility confirmed:concurrency-discipline ACR clean: concurrency-discipline confirmed:correctness ACR clean: correctness confirmed:human-readability ACR clean: human-readability confirmed:missed-context ACR clean: missed-context confirmed:probes ACR: the probes lens's latest round found no blocker confirmed:regression-safety ACR clean: regression-safety confirmed:replay-determinism ACR clean: replay-determinism ready All ACR dimensions confirmed - clear to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

durable: small cleanups from the #234 reviews

2 participants